package com.grape.dp.handler.handler;
/**
 * 描述:GatewayHandler 抽象角色
 * @author: myx
 * @date: 2019/7/22 0022
 * Copyright © 2019-grape. All rights reserved.
 */
public abstract class GatewayHandler {
    /**
     * 执行下一个handler
     */
    protected GatewayHandler nextGatewayHandler;

    /**
     * 实现的handler 处理方案 强制必须实现
     */
    public abstract void service();

    /**
     * 设置下个Handler
     * @param nextGatewayHandler
     */
    public void setNextGatewayHandler(GatewayHandler nextGatewayHandler) {
        this.nextGatewayHandler = nextGatewayHandler;
    }

    /**
     *执行下个handler
     */
    protected void nextService() {
        if (nextGatewayHandler != null)
            nextGatewayHandler.service();// 指向下一关黑名单
    }
}